<script>
export default {
  name: 'Card',
  props: {
    title: {
      type: String,
      default: ''
    }
  }
}
</script>

<template>
  <div class="card-container">
    <div class="card-header-container">
      <span>{{ title }}</span>
      <div class="card-header-slot-container">
        <slot name="header" />
      </div>
    </div>
    <div class="card-body-container">
      <slot />
    </div>
  </div>
</template>

<style lang="scss">
.card-container {
  height: 100%;
  padding: 12px;
  background-color: #fff;

  .card-header-container {
    height: 40px;
    border: 1px solid #d4d4d4;
    border-top-left-radius: 6px;
    border-top-right-radius: 6px;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;

    .card-header-slot-container {
      display: flex;
      align-items: center;
    }
  }

  .card-body-container {
    height: calc(100% - 40px);
    border-bottom-left-radius: 6px;
    border-bottom-right-radius: 6px;
    border: 1px solid #d4d4d4;
    border-top-width: 0;
    overflow-y: auto;
    padding: 12px;
  }
}
</style>
